package com.ruoyi.service.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.domain.ServiceOrderscombo;
import com.ruoyi.service.service.IServiceOrderscomboService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 订单服务套餐对应Controller
 * 
 * @author ZDL
 * @date 2024-11-27
 */
@RestController
@RequestMapping("/service/orderscombo")
public class ServiceOrderscomboController extends BaseController
{
    @Autowired
    private IServiceOrderscomboService serviceOrderscomboService;

    /**
     * 查询订单服务套餐对应列表
     */
    @PreAuthorize("@ss.hasPermi('service:orderscombo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceOrderscombo serviceOrderscombo)
    {
        startPage();
        List<ServiceOrderscombo> list = serviceOrderscomboService.selectServiceOrderscomboList(serviceOrderscombo);
        return getDataTable(list);
    }

    /**
     * 导出订单服务套餐对应列表
     */
    @PreAuthorize("@ss.hasPermi('service:orderscombo:export')")
    @Log(title = "订单服务套餐对应", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceOrderscombo serviceOrderscombo)
    {
        List<ServiceOrderscombo> list = serviceOrderscomboService.selectServiceOrderscomboList(serviceOrderscombo);
        ExcelUtil<ServiceOrderscombo> util = new ExcelUtil<ServiceOrderscombo>(ServiceOrderscombo.class);
        util.exportExcel(response, list, "订单服务套餐对应数据");
    }

    /**
     * 获取订单服务套餐对应详细信息
     */
    @PreAuthorize("@ss.hasPermi('service:orderscombo:query')")
    @GetMapping(value = "/{orderscomboId}")
    public AjaxResult getInfo(@PathVariable("orderscomboId") Long orderscomboId)
    {
        return success(serviceOrderscomboService.selectServiceOrderscomboByOrderscomboId(orderscomboId));
    }

    /**
     * 新增订单服务套餐对应
     */
    @PreAuthorize("@ss.hasPermi('service:orderscombo:add')")
    @Log(title = "订单服务套餐对应", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ServiceOrderscombo serviceOrderscombo)
    {
        return toAjax(serviceOrderscomboService.insertServiceOrderscombo(serviceOrderscombo));
    }

    /**
     * 修改订单服务套餐对应
     */
    @PreAuthorize("@ss.hasPermi('service:orderscombo:edit')")
    @Log(title = "订单服务套餐对应", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServiceOrderscombo serviceOrderscombo)
    {
        return toAjax(serviceOrderscomboService.updateServiceOrderscombo(serviceOrderscombo));
    }

    /**
     * 删除订单服务套餐对应
     */
    @PreAuthorize("@ss.hasPermi('service:orderscombo:remove')")
    @Log(title = "订单服务套餐对应", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderscomboIds}")
    public AjaxResult remove(@PathVariable Long[] orderscomboIds)
    {
        return toAjax(serviceOrderscomboService.deleteServiceOrderscomboByOrderscomboIds(orderscomboIds));
    }
}
